package sr.myserver.commons;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

public class DateUtils {

    private static final DateTimeFormatter DATE8 = DateTimeFormatter.ofPattern("yyyyMMdd");
    private static final DateTimeFormatter DATE14 = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
    private static final DateTimeFormatter DATE_8 = DateTimeFormatter.ofPattern("yyyy-MM-dd");
    private static final DateTimeFormatter DATE_TIME = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
    private static final DateTimeFormatter TIME_8 = DateTimeFormatter.ofPattern("HH:mm:ss");
    private static final DateTimeFormatter TIME6 = DateTimeFormatter.ofPattern("HHmmss");

    public static String getDate() {
        return LocalDateTime.now().format(DATE8);
    }

    public static String getDateTime() {
        return LocalDateTime.now().format(DATE14);
    }

    public static String getDateFormat() {
        return LocalDateTime.now().format(DATE_8);
    }

    public static String getDateTimeFormat() {
        return LocalDateTime.now().format(DATE_TIME);
    }

    public static String getTime() {
        return LocalDateTime.now().format(TIME6);
    }

    public static String getTimeFormat() {
        return LocalDateTime.now().format(TIME_8);
    }

}
